<template>
  <div class="xd wz_white">
    <Map ref="childMap"></Map>
    <div class="jd wh_max" style="top: 0;left: 0;right: 0;bottom: 0;height: 7vh;z-index: 10">
      <topMenu class="he_max"></topMenu>
    </div>
    <div class="jd" style="top: 8vh;left: 1vh;height: 70vh;width: 24vh;z-index: 10">
      <leftMenu @showMap="showMap" @look="look" @lookCity="lookCity" class="he_max"></leftMenu>
    </div>
    <div class="jd" style="top: 8vh;right: 1vh;height: 70vh;width: 24vh;z-index: 10">
      <rightMenu @showMap="showMap" @giveShop="giveShop" @giveCar="giveCar" class="he_max"></rightMenu>
    </div>
    <div v-if="false" class="jd" style="bottom: 1vh;left: 1vh;height: 20vh;width:99vw;z-index: 10">
    </div>
  </div>
</template>
<script setup>
import Map from '../../components/Map/index.vue'
import topMenu from '../../components/DataMenu/topDataMenu.vue'
import leftMenu from '../../components/DataMenu/leftDataMenu.vue'
import rightMenu from '../../components/DataMenu/rightDataMenu.vue'
import bottomCaret_1 from '../../components/echarts/eCharts_销售折线图.vue'
import bottomCaret_2 from '../../components/echarts/eCharts_基础折线图.vue'
import {ref} from "vue";
const childMap = ref(null); // 创建一个 ref 来引用子组件

// 引入pinia
import {storeVuex} from  '@/store/modules/user'
const Vuex = storeVuex()
// 调用配送
const giveShop = (e)=>{
  childMap.value.giveShop(e)
}
// 调用汽车行驶
const giveCar = (e)=>{
  childMap.value.giveCar(e)
}
// 调用汽车行驶
const delEntity = (e)=>{
  childMap.value.delEntity(e)
}
// 查看
const look = (e)=>{
  childMap.value.lookCar(e)
}
// 查看智慧城市
const lookCity = (e)=>{
  childMap.value.lookCity(e)
}
// 操作地图Map
const showMap = (e,t)=>{
  switch (e){
    case '店铺':
      if (t){
        childMap.value.addLine('店铺');
      }else{
        childMap.value.remove('店铺');
      }
      break;
    case '快递驿站':
      if (t){
        childMap.value.addLine('快递驿站');
      }else{
        childMap.value.remove('快递驿站');
      }
      break;
    case '超市':
      if (t){
        childMap.value.addLine('超市');
      }else{
        childMap.value.remove('超市');
      }
      break;
    case '家':
      if (t){
        childMap.value.addLine('家');
      }else{
        childMap.value.remove('家');
      }
      break;
    case '客户':
      if (t){
        childMap.value.addLine('客户');
      }else{
        childMap.value.remove('客户');
      }
      break;
    case '配送路线':
      if (t){
        childMap.value.addLine('配送路线');
      }else{
        childMap.value.remove('配送路线');
      }
      break;
    case '进货位置':
      if (t){
        childMap.value.addLine('进货位置');
      }else{
        childMap.value.remove('进货位置');
      }
      break;
    case '货源位置':
      if (t){
        childMap.value.addLine('货源位置');
      }else{
        childMap.value.remove('货源位置');
      }
      break;
  }
  console.log("传递了",e,t)
}
</script>
<style scoped>

</style>
